// 打包
import request from '@/api/utils/request';

export const getUserInfoApi = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfo/infoRelease`,
    method: 'get',
    params
  });
// 历史发布
export const getReleaseRecord = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfo/releaseRecord`,
    method: 'post',
    data
  });
export const getReleaseInfo = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfo/info/` + params,
    method: 'get'
  });
// 添加文章相关信息
export const saveInfoArticle = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/saveInfoArticle`,
    method: 'post',
    data
  });
// 保存文章相关信息到草稿
export const saveInfoArticleDraft = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/saveInfoArticleDraft`,
    method: 'post',
    data
  });
// 获取文章相关信息
export const getInfoArticle = id =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/getInfoArticle/` + id,
    method: 'get'
  });
// 修改文章相关信息
export const updateInfoArticle = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/updateInfoArticle`,
    method: 'post',
    data
  });
// 删除文章中的附件
export const getRemove = id =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticleEnclosure/remove/` + id,
    method: 'delete'
  });

// 视频相关
// 视频相关信息保存到草稿箱
export const saveInfoVideoDraft = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseVideo/saveInfoVideoDraft`,
    method: 'post',
    data
  });
// 添加视频相关信息
export const saveInfoVideo = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseVideo/saveInfoVideo`,
    method: 'post',
    data
  });
// 视频Md5验证
export const videoMd5Verify = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseVideo/videoMd5Verify`,
    method: 'post',
    data
  });
// 获取视频相关信息
export const getInfoVideo = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseVideo/getInfoVideo/` + params,
    method: 'get'
  });
// 修改视频信息
export const updateInfoVideo = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseVideo/updateInfoVideo`,
    method: 'post',
    data
  });

// 文档相关
// 删除华为云文档
export const removeObsDocument = data =>
  request({
    method: 'post',
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/removeObsDocument`,
    data
  });
// 文档转pdf上传
export const uploadDocument = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/uploadDocument`,
    method: 'post',
    data
  });
// 添加文档信息
export const saveInfoDocument = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/saveInfoDocument`,
    method: 'post',
    data
  });
// 保存文档信息到草稿
export const saveInfoDocumentDraft = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/saveInfoDocumentDraft`,
    method: 'post',
    data
  });
// 获取文档相关信息
export const getInfoDocument = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/getInfoDocument/` + params,
    method: 'get'
  });
// 修改文档相关信息
export const updateInfoDocument = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseDocument/updateInfoDocument`,
    method: 'post',
    data
  });
/* 设备列表模块 */

// 获取设备类型列表接口
export const getDeviceList = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/api/device/model/list`,
    method: 'get',
    params
  });
// 根据设备类型（班牌，大屏幕）获取设备列表接口
export const getList = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/api/device/getList`,
    method: 'post',
    data
  });
// 根据设备 ID 查询设备详情接口
export const deviceInfo = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/api/device/info/` + params,
    method: 'get'
  });
//   设备列表-发布日程
export const releaseSchedule = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/recallSchedule`,
    method: 'post',
    data
  });
//   设备列表-获取设备详情-获取最近7天离线次数
export const getEquipmentRecord = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getEquipmentRecord`,
    method: 'get',
    params
  });
// 设备列表-获取设备详情-获取最近30天发布记录
export const getEquipmentReleaseRecord = data =>
  request({
    method: 'post',
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getEquipmentReleaseRecord`,
    data
  });
// 图像相关
// 图像相关信息添加
export const saveInfoImage = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseImage/saveImageAndVideoInfo`,
    method: 'post',
    data
  });
// 图像信息保存到草稿
export const saveInfoImageDraft = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseImage/saveUpdateImageAndVideoDraft`,
    method: 'post',
    data
  });
// 修改图片相关信息
export const updateInfoImage = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseImage/updateImageAndVideoInfo`,
    method: 'post',
    data
  });
// 获取图像相关信息
export const getInfoImage = id =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseImage/getImageAndVideoInfo/` + id,
    method: 'get'
  });

// 发布位置-设备类型
export const getEquipmentType = () =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/equipmentType`,
    method: 'get'
  });
// 发布位置-设备
export const getEquipment = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/equipment`,
    method: 'get',
    params
  });
// 发布位置-功能模块
export const getFunctionalModule = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/functionalModule`,
    method: 'get',
    params
  });

// 权限管理-设备列表
export const equipmentList = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/equipmentList`,
    method: 'post',
    params
  });
// 权限管理弹窗发布-增加设备
export const saveEquipment = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/saveEquipments`,
    method: 'post',
    data
  });
/**
 * 获取当前学校所有部门组织架构
 */
export const getAllDeptInfo = params =>
  request({
    method: 'get',
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/getAllDeptInfo`,
    params
  });

// 根据用户id查询所含有的设备
export const availableEquipment = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/availableEquipments`,
    method: 'post',
    data
  });

// 发布冲突检查
export const checkCollide = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfo/checkCollide`,
    method: 'post',
    data
  });
// 权限设备列表
export const devicePermissionsList = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/devicePermissionsList`,
    method: 'post',
    params
  });
// 获取登陆人身份
export const checkCurrentUserIsAdmin = id =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/userAuth/checkCurrentUserIsAdmin/` + id,
    method: 'get'
  });
// 获取设备列表
export const getDeviceListCompetence = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getDeviceListCompetence`,
    method: 'get',
    params
  });
// 发布记录位置
export const equipmentType = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfo/equipmentType`,
    method: 'get',
    params
  });
// 根据设备类型id获取设备列表 （通过设备类型 获取设备）
export const getDeviceListByDeviceTypeId = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getDeviceListByDeviceTypeId`,
    method: 'post',
    params
  });
// 根据班级ids获取设备列表
export const getDeviceByClassIds = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getDeviceByClassIds`,
    method: 'get',
    params
  });
// 设备列表-排序
export const saveEquipmentSort = data =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schEquipmentSort/saveEquipmentSort`,
    method: 'post',
    data
  });
// 设备分类列表(获取设备类型)
export const getListDeviceType = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/listDeviceType`,
    method: 'get',
    params
  });

// 东边 设备接口

// 搜索设备
export const getDeviceInfoByDeviceName = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SCUTCHEON}/deviceScheme/getDeviceInfoByDeviceName`,
    method: 'post',
    data: params
  });
// 通过组件id查询设备列表 （通过设备获取功能模块）
export const listInformationPublishDevice = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SCUTCHEON}/open/listInformationPublishDevice`,
    method: 'post',
    params
  });
// 新设备列表
export const getDeviceListEast = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseInfoPosition/getTemplateDeviceList`,
    method: 'get',
    params
  });
// 获取位置列表
export const getLocationList = () =>
  request({
    url: `/gateway/iot/location/apiGetTreeList`,
    method: 'get'
  });
// 获取班级列表
export const getClassList = () =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/getClassTree`,
    method: 'get'
  });
// 获取班级列表
export const getClassTree = () =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/releaseArticle/getClassTree`,
    method: 'get'
  });
// 获取华为云密钥
export const getAccessGet = params =>
  request({
    url: `/gateway/file/obs/accessGet`,
    method: 'post',
    params
  });
// 获取当前用户是否有泉城e学权限
export const hasApplicationPermission = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/hasApplicationPermission`,
    method: 'get',
    params
  });
// 增加设备权限(传值字段跟之前不变, 选择泉城E学的时候值要写死)
export const saveEquipments = params =>
  request({
    url: `${process.env.VUE_APP_WEB_URL_SAAS}/schControlledEquipment/saveEquipments`,
    method: 'post',
    data: params
  });
